<?php
/**
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file license.txt or that can be found at 
 * http://code.google.com/p/billboardce/wiki/License.
 *
 * @package    Image_IndexController
 * @category   Controller
 * @license    http://code.google.com/p/billboardce/wiki/License New BSD License
 * @version    SVN: $Id: $
 */

/**
 * Main image index controller
 *
 * @package    Image_IndexController
 * @category   Controller
 */
class Image_IndexController extends Zend_Controller_Action 
{
    /**
     * shows the image
     *
     */
    public function indexAction()
    {      
        $this->_helper->viewRenderer->setNeverRender();
        $this->_helper->layout->disableLayout();
            	
        $get = Zend_Registry::get('getFilter');

        if (!isset($get->imageId)) {
            return;
        }
        
        $image = new Ot_Image();

        $thisImage = $image->find($get->imageId);     
                
        if (!is_null($thisImage)) {
            
            header("Content-type: " . $thisImage->contentType);
            echo $thisImage->source;
        }
    }
}
